from selenium import webdriver
from selenium.webdriver.common.by import By
import time

# 1.打开浏览器
driver = webdriver.Chrome()

# 2.输入ecshop网址搜索首页
driver.get('https://ecshop.test2.shopex123.com')

# 3.点击注册选项
time.sleep(2)
driver.find_element(By.CLASS_NAME, 'reg').click()

# 4.获取用户名搜索框
time.sleep(2)
username = driver.find_element(By.ID, 'username')
username.send_keys('veloday')
# 5.填写邮箱
time.sleep(2)
email = driver.find_element(By.ID, 'email')
email.send_keys('942981954@qq.com')
# 6.输入密码
time.sleep(2)
password = driver.find_element(By.ID, 'password1')
password.send_keys('wu123456')
# 7.确认密码
time.sleep(2)
password2 = driver.find_element(By.ID, 'confirm_password')
password2.send_keys('wu123456')
# 8.点击同意协议并注册按钮
driver.find_element(By.CLASS_NAME, 'signup_button').click()
# 9.退出浏览器
time.sleep(2)
driver.quit()